package org.jeecg.modules.htxincailiao.order.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.htxincailiao.order.entity.HTOrderGoods;
import org.jeecg.modules.htxincailiao.order.entity.HTOrderLibrary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: ht_order_library
 * @Author: jeecg-boot
 * @Date:   2021-11-30 16:34:16
 * @Version: V1.0
 */
public interface HTOrderLibraryMapper extends BaseMapper<HTOrderLibrary> {
    @Select("<script>" +
            "SELECT * FROM ht_order_library WHERE order_id=#{orderId}" +
            "</script>")
    List<HTOrderLibrary> findAllByOrderId(@Param("orderId") String orderId);

    @Select("<script>" +
            "SELECT * FROM ht_order_library WHERE shop_id=#{shopId}" +
            "</script>")
    List<HTOrderLibrary> findAllByShopId(@Param("shopId") String shopId);

    // 判断订单状态为1-待发货、2-待收货、3-已完成才能进行下载
    @Select("<script>" +
            "SELECT * FROM ht_order_library WHERE buyer_id=#{userId} AND library_id=#{libraryId} AND order_status in (1,2,3)" +
            "</script>")
    HTOrderLibrary  findBy(@Param("userId") String userId, @Param("libraryId") String libraryId);
}
